# config.py
import os

import pyaudio


class AppConfig:
    # FastAPI应用相关配置
    APP_HOST = os.getenv('APP_HOST', '0.0.0.0')
    APP_PORT = int(os.getenv('APP_PORT', 9000))

    # FunASR模型配置
    FUNASR_HOST = "127.0.0.1"
    FUNASR_PORT = "10095"
    FUNASR_IS_SSL = True
    FUNASR_MODE = "2pass"
    FUNASR_CHUNK_SIZE = "0,10,5"

    # Qwen模型配置
    QWEN_API_BASE = "http://localhost:8000/v1"
    QWEN_API_KEY = "none"
    QWEN_MODEL = "Qwen"
    MAX_HISTORY_LENGTH = 10  # 可配置的最大对话历史消息数量

    # 音频相关配置
    AUDIO_FORMAT = pyaudio.paInt16
    AUDIO_CHANNELS = 1
    AUDIO_RATE = 16000
    AUDIO_CHUNK = int(60 * 10 / 10 / 1000 * AUDIO_RATE * 2)
    COSY_VOICE_URL = 'http://localhost:50000/inference_sft'
    AUDIO_SAMP_WIDTH = 2
    AUDIO_RATE_OUT = 22050